/***
 * 此文件集中管理发送请求的端口,并暴露数据
 */
import request from './request'
import requestMock from './requestBanner'

//每个发送请求封装为函数
export const reqCategoryList = () => {
    return request({
        method:'get',
        url:'/product/getBaseCategoryList'
    })
}

//获取大图轮播图
export const reqBannerList = () => {
    return requestMock({
        method:'get',
        url:'/banner'
    })
}

//获取小图轮播图
export const reqFloorList = () => {
    return requestMock({
        method:'get',
        url:'/floor'
    })
}

//获取search数据
export const reqSearchData = (data) => {
    return  request({
        method:'post',
        url:'/list',
        data:data
    })
}

//获取detail数据 
export const reqDetailList = (skuId) => {
    return request({
        method:'get',
        url:`/item/${skuId}`
    })
}

//提交购物车
///api/cart/addToCart/{ skuId }/{ skuNum }
export const reqAddOrUpdateShopCar = (skuId,skuNum) => {
    return request({
        method:'post',
        url:`/cart/addToCart/${skuId}/${skuNum}`
    })
}

//获取购物车列表
// /cart/cartList
export const reqShopCartList = () => {
    return request({
        method:'get',
        url:'/cart/cartList'
    })
}

//删除单个商品
export const reqDeleteCart = (skuId) => {
    return request({
        method:'delete',
        url:`/cart/deleteCart/${skuId}`
    })
}

//更新单个商品选中状态
export const reqChangeChecked = (skuID,isChecked) => {
    return request({
        method:'get',
        url:`/cart/checkCart/${skuID}/${isChecked}`
    })
}